<@>layout("/common/default.html"){
<div style="padding: 3px" >
    <form class="layui-form" id="newrole-date">
        <div class="layui-form-item">
            <label class="layui-form-label">角色名称：</label>
            <div class="layui-input-block">
                <input type="text" lay-verify="required" class="layui-input" id="name" name="name" value="${role.name}" style="width: 95%">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">角色描述：</label>
            <div class="layui-input-block">
                <input type="text" lay-verify="required" class="layui-input" id="descn" name="descn" value="${role.descn}" style="width: 95%">
            </div>
        </div>
        <input type="hidden" value="${role.id}" name="id">
        <button type="button" onclick="saverole();" class="layui-btn" style="position: relative;left: 30px">提交</button>
    </form>
</div>
<script>
    function saverole() {
        $.cajax('${ctxPath}/ajax/role/saverole', $('#newrole-date').serialize(), function (r) {
            var code = r.code;
            var msg = r.msg;
            if (code == '1') {
                $.msg(msg, function () {
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    console.log(index);
                    parent.layer.close(index); //再执行关闭z
                    parent.doSearch();
                }, code);
            } else {
                $.msg(msg, function () {
                }, 2);
            }
        });
    }
</script>
<@>}